/*
 * @Author: your name
 * @Date: 2021-09-27 16:28:51
 * @LastEditTime: 2021-09-27 19:17:41
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /egg-ts-template/app/controller/admin/home.ts
 */
import { BaseController } from '@lz-ui/egg-base/lib/base/controller';
import router from '@lz-ui/egg-router';

@router.prefix('/api/v1/admin/home', [ 'page', 'add', 'update', 'delete', 'detail', 'enable', 'disable' ])
export default class AdminHomeController extends BaseController {
  public async init() {
    this.setSchemaName('User');
    this.setSchemaNameAttributes({
      User: [ 'id', 'username', 'phone', 'user_img' ],
    });
  }

  @router.get('/index')
  public async index() {
    try {
      const { ctx } = this;
      const result = await this.service.base.getIp(ctx);
      this.resJson({ data: result });
    } catch (err) {
      this.resJson({ isFail: true, message: `${JSON.stringify(err)}` });
    }
  }
}
